﻿using Microsoft.International.Converters.PinYinConverter;

namespace WebHome_API.Tools
{
    public class CNTool
    {
        public static string GetFirstPinyin(string str)
        {
            string r = string.Empty;
            var obj = str[0];
            try
            {
                ChineseChar chineseChar = new ChineseChar(obj);
                string t = chineseChar.Pinyins[0].ToString();
                r += t.Substring(0, 1);
            }
            catch
            {
                r += obj.ToString();
            }
            return r;
        }
    }
}
